﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Account/Site.master" AutoEventWireup="true" CodeFile="Banner.aspx.cs" Inherits="Administrator_Banner" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <asp:SiteMapPath ID="SiteMapPath1" runat="server" Font-Names="Verdana" 
        Font-Size="0.8em" PathSeparator=" : " style="font-size: small">
        <CurrentNodeStyle ForeColor="#333333" />
        <NodeStyle Font-Bold="True" ForeColor="#284E98" />
        <PathSeparatorStyle Font-Bold="True" ForeColor="#507CD1" />
        <RootNodeStyle Font-Bold="True" ForeColor="#507CD1" />
    </asp:SiteMapPath>
    <br />
    <asp:Label ID="Label2" runat="server" 
        style="font-size: x-large; font-weight: 700" 
        Text="Quản lý banner quảng cáo"></asp:Label>
    <br />
    <br />
    <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
        <asp:View ID="View1" runat="server">
            <asp:GridView ID="GridView1" runat="server" AllowSorting="True" 
                AutoGenerateColumns="False" CellPadding="4" DataKeyNames="id" 
                DataSourceID="SqlDataSource1" EnableModelValidation="True" ForeColor="#333333" 
                GridLines="None" Width="100%">
                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                <Columns>
                    <asp:ImageField DataImageUrlField="url" ReadOnly="True">
                        <ControlStyle Height="100px" Width="200px" />
                        <ItemStyle Width="200px" />
                    </asp:ImageField>
                    <asp:HyperLinkField DataNavigateUrlFields="ID" 
                        DataNavigateUrlFormatString="Banner.aspx?ID={0}" DataTextField="url" 
                        HeaderText="Hình Ảnh" />
                    <asp:BoundField DataField="link" HeaderText="Địa chỉ kết" 
                        SortExpression="link" />
                    <asp:BoundField DataField="noidung" HeaderText="Nội dung" 
                        SortExpression="noidung" />
                    <asp:CommandField ShowEditButton="True">
                    <ItemStyle Width="25px" />
                    </asp:CommandField>
                </Columns>
                <EditRowStyle BackColor="#999999" />
                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            </asp:GridView>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:ConnectServer %>" 
                DeleteCommand="DELETE FROM [QuangCao] WHERE [id] = @id" 
                InsertCommand="INSERT INTO [QuangCao] ([id], [url], [link], [noidung]) VALUES (@id, @url, @link, @noidung)" 
                SelectCommand="SELECT * FROM [QuangCao]" 
                
                UpdateCommand="UPDATE [QuangCao] SET  [link] = @link, [noidung] = @noidung WHERE [id] = @id">
                <DeleteParameters>
                    <asp:Parameter Name="id" Type="Int32" />
                </DeleteParameters>
                <InsertParameters>
                    <asp:Parameter Name="id" Type="Int32" />
                    <asp:Parameter Name="url" Type="String" />
                    <asp:Parameter Name="link" Type="String" />
                    <asp:Parameter Name="noidung" Type="String" />
                </InsertParameters>
                <UpdateParameters>
                    <asp:Parameter Name="link" Type="String" />
                    <asp:Parameter Name="noidung" Type="String" />
                    <asp:Parameter Name="id" Type="Int32" />
                </UpdateParameters>
            </asp:SqlDataSource>
        </asp:View>
        <asp:View ID="View2" runat="server">
            <asp:Label ID="Label1" runat="server" style="font-style: italic" 
                Text="Cỡ ảnh 670 x 177"></asp:Label>
&nbsp;<asp:FileUpload ID="FileUpload1" runat="server" />
            &nbsp;&nbsp;
            <asp:Button ID="Button1" runat="server" onclick="Button1_Click" 
                Text="Tải lên" />
            &nbsp;
            <asp:LinkButton ID="LinkButton1" runat="server" 
                PostBackUrl="~/Administrator/Banner.aspx">Quan lại danh sách</asp:LinkButton>
        </asp:View>
    </asp:MultiView>
</asp:Content>

